//package com.mercury.ec.module.air.controller.admin.demandorder;
//
//import com.mercury.ec.framework.apilog.core.annotation.ApiAccessLog;
//import com.mercury.ec.framework.common.pojo.CommonResult;
//import com.mercury.ec.framework.common.pojo.PageParam;
//import com.mercury.ec.framework.common.pojo.PageResult;
//import com.mercury.ec.framework.common.util.object.BeanUtils;
//import com.mercury.ec.framework.excel.core.util.ExcelUtils;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroutesegment.AirDemandRouteSegmentPageReqVO;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroutesegment.AirDemandRouteSegmentRespVO;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroutesegment.AirDemandRouteSegmentSaveReqVO;
//import com.mercury.ec.module.air.dal.dataobject.demandorder.AirDemandRouteSegmentDO;
//import com.mercury.ec.module.air.service.demandorder.AirDemandRouteSegmentService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletResponse;
//import javax.validation.Valid;
//import java.io.IOException;
//import java.util.List;
//
//import static com.mercury.ec.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
//import static com.mercury.ec.framework.common.pojo.CommonResult.success;
//
//@Tag(name = "管理后台 - 机票需求订单方案行程航段")
//@RestController
//@RequestMapping("/air/demand-route-segment")
//@Validated
//public class AirDemandRouteSegmentController {
//
//    @Resource
//    private AirDemandRouteSegmentService demandRouteSegmentService;
//
//    @PostMapping("/create")
//    @Operation(summary = "创建机票需求订单方案行程航段")
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:create')")
//    public CommonResult<Long> createDemandRouteSegment(@Valid @RequestBody AirDemandRouteSegmentSaveReqVO createReqVO) {
//        return success(demandRouteSegmentService.createDemandRouteSegment(createReqVO));
//    }
//
//    @PutMapping("/update")
//    @Operation(summary = "更新机票需求订单方案行程航段")
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:update')")
//    public CommonResult<Boolean> updateDemandRouteSegment(@Valid @RequestBody AirDemandRouteSegmentSaveReqVO updateReqVO) {
//        demandRouteSegmentService.updateDemandRouteSegment(updateReqVO);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete")
//    @Operation(summary = "删除机票需求订单方案行程航段")
//    @Parameter(name = "id", description = "编号", required = true)
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:delete')")
//    public CommonResult<Boolean> deleteDemandRouteSegment(@RequestParam("id") Long id) {
//        demandRouteSegmentService.deleteDemandRouteSegment(id);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得机票需求订单方案行程航段")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:query')")
//    public CommonResult<AirDemandRouteSegmentRespVO> getDemandRouteSegment(@RequestParam("id") Long id) {
//        AirDemandRouteSegmentDO demandRouteSegment = demandRouteSegmentService.getDemandRouteSegment(id);
//        return success(BeanUtils.toBean(demandRouteSegment, AirDemandRouteSegmentRespVO.class));
//    }
//
//    @GetMapping("/page")
//    @Operation(summary = "获得机票需求订单方案行程航段分页")
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:query')")
//    public CommonResult<PageResult<AirDemandRouteSegmentRespVO>> getDemandRouteSegmentPage(@Valid AirDemandRouteSegmentPageReqVO pageReqVO) {
//        PageResult<AirDemandRouteSegmentDO> pageResult = demandRouteSegmentService.getDemandRouteSegmentPage(pageReqVO);
//        return success(BeanUtils.toBean(pageResult, AirDemandRouteSegmentRespVO.class));
//    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出机票需求订单方案行程航段 Excel")
//    @PreAuthorize("@ss.hasPermission('air:demand-route-segment:export')")
//    @ApiAccessLog(operateType = EXPORT)
//    public void exportDemandRouteSegmentExcel(@Valid AirDemandRouteSegmentPageReqVO pageReqVO,
//                                              HttpServletResponse response) throws IOException {
//        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
//        List<AirDemandRouteSegmentDO> list = demandRouteSegmentService.getDemandRouteSegmentPage(pageReqVO).getList();
//        // 导出 Excel
//        ExcelUtils.write(response, "机票需求订单方案行程航段.xls", "数据", AirDemandRouteSegmentRespVO.class,
//                BeanUtils.toBean(list, AirDemandRouteSegmentRespVO.class));
//    }
//
//}
